Skip to content

Comments

add static page to user model#93

Open
CLJoker wants to merge 1 commit intohellovietnam93:dao_bao_quang_20143564from
CLJoker:sugoi_page_03
Open

add static page to user model#93
CLJoker wants to merge 1 commit intohellovietnam93:dao_bao_quang_20143564from
CLJoker:sugoi_page_03

Conversation

@CLJoker
Copy link

@CLJoker CLJoker commented Mar 21, 2017

sign up

sign up + deleted folder static page

Gemfile Outdated
# Use sqlite3 as the database for Active Record
gem 'bcrypt', '3.1.7'
#
gem 'bootstrap-sass','3.3.7'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sử dụng nháy kép thay cho nháy đơn

Gemfile Outdated
@@ -11,6 +11,8 @@ gem 'rails', '~> 5.0.2'
# Use sqlite3 as the database for Active Record
gem 'bcrypt', '3.1.7'
#
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa tất cả comment trong file này

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file này k dùng thì xóa đi nhé

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file này k dùng thì xóa đi


@mixin box_sizing
{
-moz-box-sizing: border-box;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 dấu csh sau dấu : thôi nhé

@@ -0,0 +1,11 @@
<%provide :title, "Help"%>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cách ra trước và sau %

@@ -0,0 +1,31 @@
<% provide(:title, 'Sign up') %>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa () + sử dụng nháy kép


<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= form_for(@user) do |f| %>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa ()

@@ -0,0 +1,11 @@
<% provide(:title, @user.name) %>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa ()

config/routes.rb Outdated
@@ -1,3 +1,15 @@
Rails.application.routes.draw do
get 'static_pages/signup', to: 'users#new'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa () 1 dấu cách để ngăn thôi nhé


def user_params
params.require :user.permit :name, :email, :phonenumber, :birthday,
:password, :password_confirmation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ident, lùi so với dòng bên trên thôi

private

def user_params
params.require :user.permit :name, :email, :phonenumber, :birthday,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params.require(:user).permit :name ....
em k test code à?

<%= yield %>
<%= render "layouts/header" %>
<div class = container>
<% flash.each do |message_type, message| %>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ident

<% end %>
<%= yield %>
<%= render "layouts/footer" %>
<%= debug(params) if Rails.env.development? %>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa ()

<div class="alert alert-danger">
The form contains <%= pluralize(@user.errors.count, "error") %>.
</div>
<ul>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ident

<em>Ruby on Rails Tutorial</em>book</a>.
</p>

</body>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cái j đya?

<em>Ruby on Rails Tutorial</em>book</a>.
</p>

</body>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nữa

This is the home page for the <a href="http://www.railstutorial.org/">
Ruby on Rails Tutorial</a> sample application.
</h2>
<%= link_to "Sign up now!", '#', class: "btn btn-lg btn-primary"%>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sư dụng ""

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem "bcrypt", "3.1.7"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e xóa dòng này và các dòng 13, 15, 17, 19, 21, 23, 25, 27 nhé

@@ -0,0 +1,7 @@
module UsersHelper
def gravatar_for user, size: 80
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ( )

def gravatar_for user, size: 80
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user.name, class: "gravatar")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ()

@@ -0,0 +1,12 @@
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to "Sample App","#", id:"logo" %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thiếu khoảng trắng
viết đúng convention thì như này em nhé:
<%= link_to "Sample App", "#", id: "logo" %>

@@ -0,0 +1,4 @@
<!--[if lt IE 9]>
<script src = "//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

config/routes.rb Outdated
@@ -1,3 +1,15 @@
Rails.application.routes.draw do
get "static_pages/signup", to: "users#new"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e xóa dòng này và các dòng 5, 7, 9, 11 nhé

config/routes.rb Outdated

resources :users

# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
10.times do |n|
User.create name: "User #{n}", email: "email-#{n}@gmail.com"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e xóa hết comment trong file này và sửa lại cách viết dòng này nhé:
User.create! name: "User #{n}", email: "email-#{n}@gmail.com"

@@ -0,0 +1,14 @@
require 'test_helper'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use double quote " " in Rails

@@ -0,0 +1,9 @@
require 'test_helper'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use double quote " " in Rails

<h1>Help</h1>
<p>
Get help on the Ruby on Rails Tutorial at the
<a href="http://www.railstutorial.org/help">Rails Tutorial help section</a>.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ident, sao lại lùi vòa thé?

private

def user_params
params.require (:user).permit :name, :email, :phonenumber, :birthday,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params.require(:user)

sign up

sign up + deleted folder static page

readd

fix

fix second time

fix time 3

fix time 4

fix time 5

fix 6 time
end

gem "rails", "~> 5.0.2"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa dòng này em nhé

# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem "bcrypt", "3.1.7"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa dòng nhé

<nav>
<ul>
<li><%= link_to "About", static_pages_about_path %></li>
<li><%= link_to "Contact", '#' %></li>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use double quote " " in Rails

@@ -0,0 +1,11 @@
<%provide :title, "Home"%>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thiếu khoảng trắng

This is the home page for the <a href="http://www.railstutorial.org/">
Ruby on Rails Tutorial</a> sample application.
</h2>
<%= link_to "Sign up now!", "#", class: "btn btn-lg btn-primary"%>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thiếu khoảng trắng

# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
10.times do |n|
User.create name: "User #{n}", email: "email-#{n}@gmail.com"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e thêm dấu chấm than ! ngay sau create nhé:

User.create! name: "User #{n}", email: "email-#{n}@gmail.com"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants